using System;
using UserInterface.Misc;

namespace UserInterface
{
    public partial class Logout : BoardPageBase
    {
        private string loggedOutUsername;

        protected void Page_Load(object sender, EventArgs e)
        {
            if (CurrentSession.IsGuest)
            {
                Response.Redirect("~/Index.aspx");
            }

            string pageTitle = (string)GetLocalResourceObject("Title");
            MasterPage.TitleGenerator.PageTitle = pageTitle;

            MasterPage.HeaderText = (string)GetLocalResourceObject("YouHaveLoggedOut");

            loggedOutUsername = CurrentSession.User.Username;

            SessionManager.NewSession(UITools.GuestUserId);
        }

        protected string LogoutMessage
        {
            get { return String.Format((string)GetLocalResourceObject("LogoutMessage"), loggedOutUsername); }
        }
    }
}
